from pydantic import BaseModel, Field, validator


class SearchGoodsForm(BaseModel):
    # goods_cn_name: str = Field(default=None, title="中文名")
    # goods_en_name: str = Field(default=None, title="英文名")
    goods_number: str = Field(default=None, title="产品编号")
    page_num: int = Field(default=1, alias="pageNum", title="页数")
    page_size: int = Field(default=10, alias="pageSize", title="页面数量大小")

    @validator('goods_number')
    def check_password_length(cls, goods_number):
        return str(goods_number).upper()
